package com.leo.csdnspider.pipeline;

import com.leo.csdnspider.dao.LatestCommentDao;
import com.leo.csdnspider.entity.LatestComment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * @ClassName: LatestCommentPipeline
 * @Author: Leo
 * @Description: 最新评论
 * @Date: 9/3/2019 8:22 PM
 */
@Repository
public class LatestCommentPipeline implements Pipeline {

    @Autowired
    private LatestCommentDao latestCommentDao;

    @Override
    public void process(ResultItems resultItems, Task task) {
        LatestComment latestComment = resultItems.get("latestComment");
        latestCommentDao.save(latestComment);
    }
}
